//
//  PagingViewController.m
//  drug
//
//  Created by 沈鑫 on 16/4/5.
//  Copyright © 2016年 沈鑫. All rights reserved.
//

#import "PagingViewController.h"
#import "ClassificationViewController.h"
#import "YybkWebViewController.h"
@interface PagingViewController ()
@property (nonatomic, strong)UIView *lView;
@property (nonatomic, strong)UILabel *myLabel1;
@property (nonatomic, strong)UILabel *myLabel2;
@property (nonatomic, strong)UILabel *myLabel3;
@property (nonatomic, strong)UILabel *myLabel4;
@property (nonatomic, strong)UILabel *myLabel5;
@property (nonatomic, strong)UILabel *myLabel6;
@property (nonatomic, strong)UIButton *myButton1;
@property (nonatomic, strong)UIButton *myButton2;
@property (nonatomic, strong)UIButton *myButton3;
@property (nonatomic, strong)UIButton *myButton4;
@property (nonatomic, strong)UIButton *myButton5;
@property (nonatomic, strong)UIButton *myButton6;
@property (nonatomic, strong)UIImageView *myImage1;
@property (nonatomic, strong)UIImageView *myImage2;
@property (nonatomic, strong)UIImageView *myImage3;
@property (nonatomic, strong)UIImageView *myImage4;
@property (nonatomic, strong)UIImageView *myImage5;
@property (nonatomic, strong)UIImageView *myImage6;

@property (nonatomic, strong)UIButton *pushButton;
@end

@implementation PagingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"药品分类";
    
    // navigation两边button 的颜色
    // [self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
    // navigation字体的颜色 大写 型号
    [self.navigationController.navigationBar setTitleTextAttributes: @{NSFontAttributeName: [UIFont fontWithName:@"Arial-BoldItalicMT" size:19],
                                                                       
                                                                       
                                                                       NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.164 green:0.657 blue:0.915 alpha:1.000];

    self.lView = [[UIView alloc]initWithFrame:CGRectMake(KWIDTH / 3, 0, 1, KWIDTH / 3 * 2)];
    self.lView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:_lView];
    
    self.lView = [[UIView alloc]initWithFrame:CGRectMake(KWIDTH / 3 * 2, 0, 1, KWIDTH / 3 * 2)];
    self.lView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:_lView];
    
    self.lView = [[UIView alloc]initWithFrame:CGRectMake(0, 1 + KWIDTH / 3, KWIDTH, 1)];
    self.lView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:_lView];
    
    self.lView = [[UIView alloc]initWithFrame:CGRectMake(0,  KWIDTH / 3 * 2, KWIDTH, 1)];
    self.lView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:_lView];
    
    _myButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton1.frame = CGRectMake(0, 0, KWIDTH / 3, KWIDTH / 3);
    [_myButton1 addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_myButton1];
    _myImage1 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    _myImage1.image = [UIImage imageNamed:@"yaoxiang"];
    [_myButton1 addSubview:_myImage1];
    _myLabel1 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel1.text = @"家庭药箱";
    [_myButton1 addSubview:_myLabel1];
    
    
    _myButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton2.frame = CGRectMake(KWIDTH / 3, 0, KWIDTH / 3, KWIDTH / 3);
    [self.view addSubview:_myButton2];
    _myImage2 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    [_myButton2 addTarget:self action:@selector(buttonAction2:) forControlEvents:UIControlEventTouchUpInside];
    _myImage2.image = [UIImage imageNamed:@"wendu"];
    [_myButton2 addSubview:_myImage2];
    _myLabel2 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel2.text = @"感冒用药";
    [_myButton2 addSubview:_myLabel2];
    
    
    _myButton3 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton3.frame = CGRectMake(KWIDTH / 3 * 2, 0, KWIDTH / 3, KWIDTH / 3);
    [_myButton3 addTarget:self action:@selector(buttonAction3:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_myButton3];
    _myImage3 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    _myImage3.image = [UIImage imageNamed:@"weishengsu"];
    [_myButton3 addSubview:_myImage3];
    _myLabel3 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel3.text = @"维生素药";
    [_myButton3 addSubview:_myLabel3];
    
    
    _myButton4 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton4.frame = CGRectMake(0, 1 + KWIDTH / 3, KWIDTH / 3, KWIDTH / 3);
    [_myButton4 addTarget:self action:@selector(buttonAction4:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_myButton4];
    _myImage4 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    _myImage4.image = [UIImage imageNamed:@"fuke"];
    [_myButton4 addSubview:_myImage4];
    _myLabel4 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel4.text = @"妇科用药";
    [_myButton4 addSubview:_myLabel4];
    
    
    _myButton5 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton5.frame = CGRectMake(KWIDTH / 3, 1 + KWIDTH / 3, KWIDTH / 3, KWIDTH / 3);
    [_myButton5 addTarget:self action:@selector(buttonAction5:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_myButton5];
    _myImage5 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    _myImage5.image = [UIImage imageNamed:@"nanke"];
    [_myButton5 addSubview:_myImage5];
    _myLabel5 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel5.text = @"男科用药";
    [_myButton5 addSubview:_myLabel5];
    
    
    _myButton6 = [UIButton buttonWithType:UIButtonTypeCustom];
    _myButton6.frame = CGRectMake(KWIDTH / 3 * 2, 1 + KWIDTH / 3, KWIDTH / 3, KWIDTH / 3);
    [_myButton6 addTarget:self action:@selector(buttonAction6:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_myButton6];
    _myImage6 = [[UIImageView alloc]initWithFrame:CGRectMake((KWIDTH / 3) / 3, (KWIDTH / 3) / 3 - 10, (KWIDTH / 3) / 3, (KWIDTH / 3) / 3)];
    _myImage6.image = [UIImage imageNamed:@"erke"];
    [_myButton6 addSubview:_myImage6];
    _myLabel6 = [[UILabel alloc]initWithFrame:CGRectMake(KWIDTH / 3 / 5, KWIDTH / 3 / 1.5, KWIDTH / 3 * 4, 20)];
    _myLabel6.text = @"儿科用药";
    [_myButton6 addSubview:_myLabel6];
    
    
    _pushButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _pushButton.frame = CGRectMake(0, KWIDTH / 3 * 2 + 1, KWIDTH, KHEIGHT - KWIDTH / 3 * 2 - 1 - 64);
    [_pushButton setImage:[UIImage imageNamed:@"yao"] forState:UIControlStateNormal];
    [_pushButton addTarget:self action:@selector(pushButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_pushButton];
    
}

#pragma mark --- 跳转网页 ---
- (void)pushButtonAction:(UIButton *)button
{
    YybkWebViewController *yybk = [[YybkWebViewController alloc]init];
    [self.navigationController pushViewController:yybk animated:YES];
}

#pragma mark --- 家庭药箱 ---
- (void)buttonAction1:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"家庭用药";
    class.number = 3;
    [self.navigationController pushViewController:class animated:YES];
}

#pragma mark --- 感冒用药 ---
- (void)buttonAction2:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"感冒用药";
    class.number = 4;
    [self.navigationController pushViewController:class animated:YES];
}

#pragma mark --- 维生素 ---
- (void)buttonAction3:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"维生素药";
    class.number = 5;
    [self.navigationController pushViewController:class animated:YES];
}

#pragma mark --- 妇科用药 ---
- (void)buttonAction4:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"妇科用药";
    class.number = 6;
    [self.navigationController pushViewController:class animated:YES];
}

#pragma mark --- 男科用药 ---
- (void)buttonAction5:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"男科用药";
    class.number = 7;
    [self.navigationController pushViewController:class animated:YES];
}

#pragma mark --- 儿科用药 ---
- (void)buttonAction6:(UIButton *)button
{
    ClassificationViewController *class = [[ClassificationViewController alloc]init];
    class.navigationItemTitle = @"儿科用药";
    class.number = 8;
    [self.navigationController pushViewController:class animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
